<?php
/**
 * @package		Joomla.Site
 * @subpackage	com_content
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');

preg_match('/youtube.com\/embed\/(.*?)\?/', $this->lead_items[0]->introtext, $match);
$fvideo = $match[1];

?>

<script type="text/javascript">
function changeVideo(id, item)
{
	$('#videos-list .video-item').css('background', '#fff');
	$(item).parent().css('background', '#dddddd');
	$('#youtube_playing').html('<object width="670" height="445"><param name="movie" value="http://www.youtube.com/v/'+id+'?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+id+'?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="670" height="445" allowscriptaccess="always" allowfullscreen="true"></embed></object>');
}

	jQuery(document).ready(function($) {
		//alert("jquery okie");
		$('#videos-list .video-item').first().css('background', '#dddddd');
	});
</script>

<div class="blog<?php echo $this->pageclass_sfx;?>">



	<?php if ($this->params->get('show_page_heading', 1)) : ?>
	<h1>
		<?php echo $this->escape($this->params->get('page_heading')); ?>
	</h1>
	<?php endif; ?>

	<?php if ($this->params->get('show_category_title', 1) or $this->params->get('page_subheading')) : ?>
	<h2>
		<?php echo $this->escape($this->params->get('page_subheading')); ?>
		<?php if ($this->params->get('show_category_title')) : ?>
			<span class="subheading-category"><?php echo $this->category->title;?></span>
		<?php endif; ?>
	</h2>
	<?php endif; ?>


<div id="youtube_playing">

	<object width="670" height="445"><param name="movie" value="http://www.youtube.com/v/<?php echo $fvideo; ?>?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $fvideo; ?>?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="670" height="445" allowscriptaccess="always" allowfullscreen="true"></embed></object>

</div>



<?php $leadingcount=0 ; ?>
<?php if (!empty($this->lead_items)) : ?>
<div id="videos-list">
	<?php foreach ($this->lead_items as &$item) : ?>
		<div class="video-item leading-<?php echo $leadingcount; ?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?>">
			<?php
				$this->item = &$item;
				echo $this->loadTemplate('item');
			?>
		</div>
		<?php
			$leadingcount++;
		?>
	<?php endforeach; ?>
</div>
<?php endif; ?>

<br style="clear: both" />

<?php if (($this->params->def('show_pagination', 1) == 1  || ($this->params->get('show_pagination') == 2)) && ($this->pagination->get('pages.total') > 1)) : ?>
		<div class="pagination">
						<?php  if ($this->params->def('show_pagination_results', 1)) : ?>
						<p class="counter">
								<?php echo $this->pagination->getPagesCounter(); ?>
						</p>

				<?php endif; ?>
				<?php echo $this->pagination->getPagesLinks(); ?>
		</div>
<?php  endif; ?>
</div>



